﻿namespace ImageProcessing
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading;
    using System.Windows.Forms;

    /// <summary>
    /// Splash screen form
    /// </summary>
    public partial class PHLogo : Form
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="PHLogo"/> class.
        /// </summary>
        public PHLogo()
        {
            this.InitializeComponent();
            this.BackColor = Color.Black;
            this.TransparencyKey = Color.Black;
            this.WindowState = FormWindowState.Maximized;
            this.pictureBox1.Size = this.Size;
            this.pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
        }

        /// <summary>
        /// Exits this instance.
        /// </summary>
        public void Exit()
        {
            Thread.Sleep(1000);
            while (this.Opacity > 0)
            {
                this.Opacity -= 0.07;
                Thread.Sleep(1);
            }

            this.Close();
        }

        /// <summary>
        /// Handles the Click event of the PictureBox1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void PictureBox1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        /// <summary>
        /// Handles the Load event of the PHLogo control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void PHLogo_Load(object sender, EventArgs e)
        {
            Form.CheckForIllegalCrossThreadCalls = false;
            Thread t = new Thread(this.Exit);
            t.Start();
        }
    }
}
